package orlowski.kamil.simple.app.activity;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
import orlowski.kamil.simple.app.MainApplication;
import orlowski.kamil.simple.app.R;
import orlowski.kamil.simple.app.domain.Country;


/**
 * Created by Kamil on 2014-10-15.
 */
public class DetailsActivity extends Activity {
    public MainApplication mainApplication;
    public TextView countryName;
    public TextView countryCode;
    public ImageView countryImage;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.details_activity);

        countryName = (TextView) findViewById(R.id.CountryName);
        countryCode = (TextView) findViewById(R.id.CountryCode);
        countryImage = (ImageView) findViewById(R.id.CountryImage);

        mainApplication = (MainApplication) getApplication();
        change(mainApplication.getSelectedCountry());
    }

    public void change(Country country) {
        countryName.setText(country.getCountryName());
        countryCode.setText(country.getCountryCode());
        countryImage.setImageResource(country.getImagePath());
    }
}